package org.airline.service;

import java.util.List;

import javax.annotation.Resource;

import org.airline.dao.IFlightDao;
import org.airline.entity.Flight;
import org.airline.entity.PageBean;
import org.springframework.stereotype.Component;

@Component("FlightInfoService")
public class FlightInfoService implements IFlightDao{
	
	private IFlightDao iFlightDao;

	@Override
	public void deleteFlightById(int id) throws Exception {
		this.iFlightDao.deleteFlightById(id);
	}

	@Override
	public List<Flight> getAllFlight() throws Exception {
		return this.iFlightDao.getAllFlight();
	}

	@Override
	public Flight getAllFlightById(int id) throws Exception {
		return this.iFlightDao.getAllFlightById(id);
	}

	@Override
	public boolean insertFlight(Flight flight) throws Exception {
		return this.iFlightDao.insertFlight(flight);
	}

	@Override
	public void updateFlight(Flight flight) throws Exception {
		this.iFlightDao.updateFlight(flight);
	}

	public IFlightDao getiFlightDao() {
		return iFlightDao;
	}

	@Resource(name="FlightDaoImpl")
	public void setiFlightDao(IFlightDao iFlightDao) {
		this.iFlightDao = iFlightDao;
	}

	@Override
	public PageBean queryForPage(int pageSize, int page) throws Exception {
		return iFlightDao.queryForPage(pageSize, page);
	}

	@Override
	public List<Flight> getFlightsByWords(String keyWord) throws Exception {
		return iFlightDao.getFlightsByWords(keyWord);
	}

	@Override
	public PageBean queryForPageByKeyWords(String keyWord, int pageSize,
			int page) throws Exception {
		return iFlightDao.queryForPageByKeyWords(keyWord, pageSize, page);
	}
	
}
